[#escape x as (x)!?html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>用户注册_${site.fullNameOrName}</title>
    <script language="javascript" type="text/javascript" src="${fore}/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="${fore}/bluewise.js"></script>
    <script language="javascript" type="text/javascript" src="${fore}/fore.js"></script>
    <script language="javascript" type="text/javascript" src="_files/common.js"></script>
    <script language="javascript" type="text/javascript" src="${fore}/jquery.validation_zh_CN.js"></script>
    <link href="_files/css/base.css" type="text/css" rel="stylesheet"/>
    <style type="text/css">
        .error {
            color: #ff0000
        }
    </style>
    <script type="text/javascript">

        GetLength = function(str)
        {
            var realLength = 0;
            for (var i = 0; i < str.length; i++)
            {
                charCode = str.charCodeAt(i);
                if (charCode >= 0 && charCode <= 128)
                    realLength += 1;
                else
                    realLength += 2;
            }
            return realLength;
        }

        $(function () {
            $("input[name='agree']").click(function () {
                $("input[name='register']").attr("disabled", !this.checked);
            });
            $.validator.addMethod("username", function (value) {
                if (value.length == 0) {
                    return true;
                }
                var p = /${global.register.validCharacter}/;
                return p.exec(value) ? true : false;
            }, "用户名必须是字母、数字和汉字");
            $("#validForm").validate({
                rules: {
                    mobile: {required: true},
                    verifycode: {required: true},
                    email: {required: true, email: true},
                    password: {required: true},
                    password_repeat: {required: true, equalTo: "input[name='password']"},
                    realname: {required: true},
                    hospital: {required: true},
                    sel_are: {required: true}
                },
                messages: {
                    mobile: {required: "手机号必填"},
                    verifycode: {required: "验证码必填"},
                    email: {required: "必填", email: "电邮错误"},
                    password: {required: "必填"},
                    password_repeat: {required: "必填", equalTo: "两次密码不同"},
                    realname: {required: "必填"},
                    hospital: {required: "必填"},
                    sel_are: {required: "必填"}
                },
                submitHandler: function (form) {
                    $.ajax({
                        data: $(form).serialize(),
                        type: "POST",
                        url: "/registerAjax.jspx",
                        contentType: "application/x-www-form-urlencoded;",
                        dataType: 'json',
                        success: function (response, textStatus, jqXHR) {
                            alert(response.message);
                            if (response.code >= 0) {
                                window.location.href = '/login.jspx';
                            }
                        },
                        error: function (xhr, textStatus, errorThrown) {
                            alert(errorThrown);
                        }
                    });
                    return false;
                }
            });
        });

        function checkRead() {
            var checked = $("input[name='agree']").attr("checked");
            if (checked == true || checked == "checked") {
                return true;
            } else {
                alert('注册请同意服务协议');
                return false;
            }
        }

    </script>
</head>
<body>
<div class="tbanner">
    <h1>珍医网</h1>

    <div class="tbanpic"><img src="_files/img/ban.jpg" width="722" height="100"/></div>
</div>
<div class="loginmain">
    <span class="t"></span><span class="b"></span>

    <div class="logtit">请您填写正确用户信息登录</div>
    <div class="logl">
        <div class="zclcon">

            <div class="fratab" id="utab2">
                <a href="/register.jspx?mode=email" class="[#if mode='email']cur[/#if]">邮箱注册</a>
                <a href="/register.jspx?mode=sms" class="[#if mode='sms']cur[/#if]">手机注册</a>
            </div>
            <form id="validForm" action="${ctx}/registerAjax.jspx" method="post">
                <div class="tabcon" id="formcontent">
                    <input type="hidden" name="mode" value="${mode}"/>
                    [#if mode="email"]

                    <div class="framp">
                        <label>Email：</label>
                        <input name="email" type="text" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>密码：</label>
                        <input name="password" type="password" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>确认密码：</label>
                        <input name="password_repeat" type="password" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>昵称：</label>
                        <input name="nickname" type="text" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>真实姓名：</label>
                        <input name="realname" type="text" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>所在地：</label>
                        [#include "inc_area.html"]
                    </div>
                    <div class="framp">
                        <label>医院：</label>
                        <input name="" type="text" class="txt1"/>
                    </div>
                    <div class="framp"><input name="agree" type="checkbox" value="" class="ml"/>
                        <a target="_blank" href="/info/224.jspx">我已阅读并同意服务协议</a></div>
                    <div class="framp">
                        <input name="register" type="submit" class="fbtn" onclick="return checkRead()" value="注册"/>
                    </div>
                    [/#if]

                    [#if mode=="sms"]
                    <div class="framp">
                        <label>手机：</label>
                        <input name="mobile" type="text" class="txt2"/><a href="#" onclick="getsmscode()" class="frabtn2">免费获取短信效验码</a>
                    </div>
                    <div class="framp">
                        <label>短信效验码：</label>
                        <input name="verifycode" type="text" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>密码：</label>
                        <input name="password" type="password" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>确认密码：</label>
                        <input name="password_repeat" type="password" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>昵称：</label>
                        <input name="nickname" type="text" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>真实姓名：</label>
                        <input name="realname" type="text" class="txt1"/>
                    </div>
                    <div class="framp">
                        <label>所在地：</label>
                        [#include "inc_area.html" /]
                    </div>
                    <div class="framp">
                        <label>医院：</label>
                        <input name="hospital" type="text" class="txt1"/>
                    </div>
                    <div class="framp"><input name="agree" type="checkbox" value="" class="ml"/>
                        <a target="_blank" href="/info/224.jspx">我已阅读并同意服务协议</a></div>
                    <div class="framp">
                        <input name="register" type="submit" class="fbtn" onclick="return checkRead()" value="注册"/>
                    </div>
                    [/#if]

                </div>
            </form>
        </div>

    </div>
    <div class="logr">
        <div class="loginzh">
            <strong>已有账号?</strong>
            <a href="/login.jspx" class="fbtn">登录</a>
            <strong>其他账号登录</strong>
            <div style="float: left" id="qqLoginBtn">
                <a href="javascript:;" onclick="window.location.href='/oauth/checkqq.jspx'">
                    <img src="http://qzonestyle.gtimg.cn/qzone/vas/opensns/res/img/Connect_logo_7.png" alt="QQ登录" border="0">
                </a>
            </div>
            <div style="float: left">&nbsp;&nbsp;&nbsp;</div>
            <div style="float: left" id="wb_connect_btn">
                <a href="javascript:;" onclick="window.location.href='/oauth/checkweibo.jspx'">
                    <img src="http://timg.sjs.sinajs.cn/t4/appstyle/widget/images/loginButton/loginButton_24.png">
                </a>
            </div>
        </div>
        <ul class="loglist">
            <li><a href="/node/82.jspx" target="_blank"><img src="_files/img/mpic01x.jpg" width="124" height="110"/></a>
            </li>
            <li><a href="/node/76.jspx" target="_blank"><img src="_files/img/mpic02x.jpg" width="124" height="110"/></a>
            </li>
            <li><a href="/node/83.jspx" target="_blank"><img src="_files/img/mpic03x.jpg" width="124" height="110"/></a>
            </li>
            <li><a href="/node/36.jspx" target="_blank"><img src="_files/img/mpic04x.jpg" width="124" height="110"/></a>
            </li>
        </ul>
    </div>
</div>
[#include 'inc_footer.html'/]
<script type="text/javascript">
    function getsmscode() {
        var mobile = $("[name='mobile']").val();
        if ($.trim(mobile) == '') {
            alert("手机号码不能为空");
            return;
        }
        $.ajax({
            type: "GET",
            url: "/mobile/send.jspx",
            data: "mobile=" + mobile,
            success: function (json) {
                //alert("Data Saved: " + json.message);
                if (json.code > 0) {
                    alert('验证码已发送,请注意查看');
                } else {
                    alert(json.message);
                }

            }
        })
    }
</script>
</body>
</html>

[/#escape]